package cn.lili.modules.promotion.client;

import cn.lili.modules.constant.ServiceConstant;
import cn.lili.modules.promotion.entity.dos.RedPackGoods;
import cn.lili.modules.promotion.entity.dto.search.RedPackGoodsSearchParams;
import cn.lili.modules.promotion.entity.vos.RedPackGoodsVO;
import cn.lili.modules.promotion.fallback.PointsGoodsFallback;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author: ftyy
 * @date: 2022-01-13 19:26
 * @description: 积分商品Client
 */
@FeignClient(path = "${server.servlet.context-path}", name = ServiceConstant.PROMOTION_SERVICE, contextId = "red-pack-goods", fallback = PointsGoodsFallback.class)
public interface RedPackGoodsClient {

    /**
     * 批量保存库存商品
     *
     * @param promotionsList 红包商品列表
     * @return 是否保存成功
     */
    @PostMapping("/feign/promotion/redPack-goods/saveRedPackGoodsBatch")
    boolean saveRedPackGoodsBatch(@RequestBody List<RedPackGoods> promotionsList);

    /**
     * 根据ID获取红包详情
     *
     * @param id 积分商品id
     * @return 积分详情
     */
    @GetMapping("/feign/promotion/redPack-goods/getRedPackGoodsDetail/{id}")
    RedPackGoodsVO getRedPackGoodsDetail(@PathVariable String id);

    /**
     * 根据ID获取积分详情
     *
     * @param skuId 商品SkuId
     * @return 积分详情
     */
    @GetMapping("/feign/promotion/redPack-goods/getRedPackGoodsDetailBySkuId/{skuId}")
    RedPackGoodsVO getRedPackGoodsDetailBySkuId(@PathVariable String skuId);

    @PutMapping("/feign/promotion/redPack-goods/updateById")
    void updateById(@RequestBody RedPackGoodsVO redPackGoodsVO);

    @PostMapping("/feign/promotion/redPack-goods/deleteRedPackGoods")
    Boolean deleteRedPackGoods(@RequestBody RedPackGoodsSearchParams redPackGoodsSearchParams);

}
